import 'package:flutter/material.dart';

import '../../config/public_color.dart';

/// FileName public_arrow
///
/// @Author lax
/// @Date 2023/11/7
///
/// @Description

class PublicArrow extends StatelessWidget {
  final AxisDirection? direction;

  final Color? color;

  final double? size;

  final double? width;

  final double? height;

  final String? name;

  final EdgeInsets? margin;

  const PublicArrow({
    super.key,
    this.direction = AxisDirection.right,
    this.color,
    this.size,
    this.width,
    this.height,
    this.name,
    this.margin,
  });

  @override
  Widget build(BuildContext context) {
    if (name == null && direction == null) {
      return const SizedBox();
    }
    if (margin == null) {
      return image();
    }
    return Padding(
      padding: margin ?? EdgeInsets.zero,
      child: image(),
    );
  }

  Widget image() {
    return Image.asset(
      name ?? 'assets/icon_arrow_${direction?.name}.png',
      package: 'flutter_public',
      width: width ?? size,
      height: height ?? size,
      color: color ?? PublicColor.lightText,
    );
  }
}
